import RequestUtils from '@/utils/RequestUtils'

const groupName = 'transport'
const apiName = 'routePriceNew'

export default {
  add(params) {
    if (!params) params = {}
    return RequestUtils({
      url: `/${groupName}/${apiName}`,
      method: 'post',
      data: {
        ...params
      }
    })
  },
  remove(id) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/${id}`,
      method: 'delete'
    })
  },
  edit(params) {
    if (!params) params = {}
    return RequestUtils({
      url: `/${groupName}/${apiName}/${params.id}`,
      method: 'put',
      data: {
        ...params
      }
    })
  },
  get(id) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/${id}`,
      method: 'get'
    })
  },
  list(params) {
    if (!params) params = {}
    return RequestUtils({
      url: `/${groupName}/${apiName}/search`,
      method: 'post',
      data: {
        ...params
      }
    })
  },
  page(params, page) {
    if (!params) params = {}
    return RequestUtils({
      url: `/${groupName}/${apiName}/search/${page.currentPage}/${page.pageSize}`,
      method: 'post',
      data: {
        ...params
      }
    })
  }
}
